#ifndef PID_CONTROLLER_HPP
#define PID_CONTROLLER_HPP

class PIDController {
public:
    explicit PIDController();
    explicit PIDController(double kp,double ki,double kd);

    virtual ~PIDController() = default;

    virtual double getKp(void);
    virtual void setKp(double kp);
    virtual double getKi(void);
    virtual void setKi(double ki);
    virtual double getKd(void);
    virtual void setKd(double kd);

    virtual double getIntegralTime(void);
    virtual void setIntegralTime(double tau_i);
    virtual double getDifferentialTime(void);
    virtual void setDifferentialTime(double tau_d);

    virtual double iterate(double error,double sampling_period);
    virtual void reset(void);

protected:
    double kp = 0.0;
    double ki = 0.0;
    double kd = 0.0;
    double last_error = 0.0;
    double integral_error = 0.0;
    bool flag_first_iteration = true;
};

#endif
